package com.comdev.ctrls.test;

import com.comdev.ut.string.StringUT;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * User: zhu
 * Date: 13-4-22
 * Time: 下午10:44
 */
@Controller
@RequestMapping("upload")
public class upload
{

    @RequestMapping("show")
    public String show()
    {
        return "test/upload/show";
    }


    @RequestMapping("upload_dialog")
    public ModelAndView upload_dialog(@RequestParam("rsdiv")String rsdiv,@RequestParam("onesize")int onesize,@RequestParam("count")int count,@RequestParam("filetypes")String filetypes ,
                                      HttpServletRequest request,
                                      HttpServletResponse reps)
    {
        ModelAndView mod = new ModelAndView();
        mod.setViewName("file/upload_dialog");
        mod.addObject("JSESSIONID", StringUT.JSESSIONID(request));
        mod.addObject("onesize",onesize*1024*1000);//单位是字节，传过来的数字是兆 MB
        mod.addObject("onesize_",onesize);//单位是字节，传过来的数字是兆 MB
        mod.addObject("count", count);
        mod.addObject("filetypes", filetypes);
        mod.addObject("rsdiv", rsdiv);

        //Set-Cookie	JSESSIONID=cjpjezkswurq;Path=/
//        reps.setHeader("Set-Cookie","JSESSIONID="+StringUT.JSESSIONID(request)+";Path=/");
        return mod;
    }


}
